package com.sense.kukoo.common.media

import android.app.Application
import com.sense.kukoo.common.media.history.MusicHistoryImpl
import com.sense.kukoo.common.media.input.UserInputImpl
import com.sense.kukoo.common.media.play.MediaPlayImpl
import com.sense.kukoo.common.media.playlist.MusicPlayListImpl
import com.sense.kukoo.common.media.timer.TimerImpl
import com.sense.kukoo.common.media.watcher.UserWatcherImpl
import com.sense.kukoo.lib_logger.LoggerManager

object Kukoo {

    private val TAG: String = javaClass.simpleName

    fun init(app: Application){
        /*val o1 = object: IServiceNotifier {
            override fun notifyService(startOrStop: Boolean) {
                LoggerManager.e(TAG, "notifyService - startOrStop=${startOrStop}")
            }
        }
        val o2 = object : ICacheProxy {
            override fun getCacheUrl(url: String?): String {
                //val notificationUrl = Uri.parse("android.resource://" + "com.sense.kukoo.common" + "/" + R.raw.notification)
                LoggerManager.e(TAG, "getCacheUrl - url=${url}")
                return url+""
            }
        }
        DefaultPlayerManager.getInstance().init(app, o1, o2)*/
    }

    val input: UserInputImpl by lazy(mode = LazyThreadSafetyMode.SYNCHRONIZED) {
        UserInputImpl()
    }

    val watcher: UserWatcherImpl by lazy(mode = LazyThreadSafetyMode.SYNCHRONIZED) {
        UserWatcherImpl()
    }

    /*val play: MusicPlayer by lazy(mode = LazyThreadSafetyMode.SYNCHRONIZED) {
        MusicPlayerImpl()
    }*/

    /*val play: DefaultPlayerManager by lazy(mode = LazyThreadSafetyMode.SYNCHRONIZED) {
        DefaultPlayerManager.getInstance()
    }*/

    val play: MediaPlayImpl by lazy(mode = LazyThreadSafetyMode.SYNCHRONIZED) {
        MediaPlayImpl()
    }

    val playlist: MusicPlayListImpl by lazy(mode = LazyThreadSafetyMode.SYNCHRONIZED) {
        MusicPlayListImpl()
    }

    val history: MusicHistoryImpl by lazy(mode = LazyThreadSafetyMode.SYNCHRONIZED) {
        MusicHistoryImpl()
    }

    val timer: TimerImpl by lazy(mode = LazyThreadSafetyMode.SYNCHRONIZED) {
        TimerImpl()
    }

}